package cn.ad.enumration;

import java.util.HashMap;
import java.util.Map;

/**
 * 广告主审核状态枚举
 * Created by Administrator on 2016/9/2.
 */
public enum  AdvertiserAuditStatus {
    UNAUDIT(0,"待审核"),
    AUDITTING(1,"审核中"),
    AUDITED(2,"审核通过"),
    FAILURE(-1,"审核失败")
    ;

    private int name;
    private String value;

    private static Map<Integer,String> mappings;

    private synchronized static Map<Integer,String> getMappings(){
        if (mappings==null){
            mappings=new HashMap<>();
            for (AdvertiserAuditStatus status:AdvertiserAuditStatus.values()) {
                mappings.put(status.name,status.value);
            }
        }
        return mappings;
    }

    AdvertiserAuditStatus(int name, String value) {
        this.name = name;
        this.value = value;
    }

    public int getName() {
        return name;
    }

    public void setName(int name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static String forValue(Integer name){
        return getMappings().get(name).toString();
    }
}
